Ext.define("AmpleHarvest.objects.search.results.grid.AppResultsGrid", {
   extend: 'Ext.grid.Panel',
   alias: 'widget.ampleharvest-objects-search-results-grid-appresultsgrid',
   
   requires: ['AmpleHarvest.DATA.Store.AppSearchStore'],

   layout: 'fit',
   width: '100%',
   requires : [ ],
   columns        :
         [
               {  header      : 'Name', dataIndex   : 'appName', width: 200, sortable : true,
                  renderer: function(value, metaData, record) { return "<b>"+value+"</b>" } },
                  
               {  header      : 'Version',    dataIndex   : 'infVersion', width: 50, sortable : true},
               {  header      : 'Date Downloaded',    dataIndex   : 'dateDownloaded', sortable : true,
                  renderer: function(value, metaData, record) { return value } },
                  
               {  header      : 'Date Profiled',    dataIndex   : 'dateProfiled', sortable : true,
                  renderer: function(value, metaData, record) { return value } },
                  
               {  header      : 'Profiler Version',    dataIndex   : 'profilerVersion', sortable : true},
               {  header      : 'Source',    dataIndex   : 'infSource', sortable : true}
         ],
         
   
   
   constructor: function(config) {

      this.store = Ext.create('AmpleHarvest.DATA.Store.AppSearchStore');
      
      this.dockedItems= [{
        xtype: 'pagingtoolbar',
        store: this.store, //Ext.data.StoreManager.lookup('myRegistryInfo'),   // same store GridPanel is using
        dock: 'bottom',
        displayInfo: true
    }],
        this.callParent(arguments);
    },
    
   initComponent : function()
   {
      this.addListener({
           'itemdblclick' : this.itemdblclick
      });
      
      this.callParent();
   },
    
   itemdblclick : function(viewThis, record)
   {
   	m_obj_AmpleHarvest_ViewPort.fireEvent( AmpleHarvest.eventHandler.cWindowEvents.C_STR_EVENT_APPLICATION_OPEN, record );
   },
   
   loadURL  : function(url)
   {
   	this.store.loadSearchParam(Ext.decode(url.Json_Query).Query[0].value);
   	this.store.load();
   }
});